<?php
$this->pageTitle = $model->name;
?>
<style>#main-content li {
	margin-left:20px;
}

#main-content ol {
	padding-left: 20px;
	line-height:24px;
    background-color:#efefef;
    border: 1px solid #ccc;
}

#main-content h3 {
	margin: 10px 0px;
	padding: 5px 0px 5px 10px;
	border-radius: 5px;
	background-color: #fff;
    border: 1px solid #ccc;
}

#main-content h3 a {
	text-decoration:none;
	color:#4bf;
}

#main-content li a {
	text-decoration:none;
	color:#123;	
    font-size:12px;
    line-height:24px;
    font-weight:500;
}


</style>

<div style="width:270px;float:left;">
<div id="ProductSortCssID">

<ul id="pstMenu">

<?php 
$children = ProductCategory::model()->findAll(array('condition'=>'parent_id=1'));
foreach($children as $cat) {
    $list[] = $cat->id;
?>
<li>
    <?php echo CHtml::link($cat->name, array('productCategory/index','id'=>$cat->id));?>
    <ul>
        <?php 
        $subcat = ProductCategory::model()->findAll(array('condition'=>'parent_id='.$cat->id));
        foreach($subcat as $a) {
            echo "<li>".CHtml::link($a->name, array('productCategory/index','id'=>$a->id))."</li>";

        }
             ?>
    </ul>
</li>
<?php } ?>

</ul>

<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>

<script type="text/javascript">
sfHover = function() { 
    var sfEls = document.getElementById("pstMenu").getElementsByTagName("LI");
    for (var i=0; i<sfEls.length; i++) { 
        sfEls[i].onmouseover=function() { 
            this.className+=" sfhover";
        }
        sfEls[i].onmouseout=function() { 
            this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
        }
    }
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

</script>
</div>
</div>
<div style="width:700px;float:right;margin:0px 0px 50px 0px;">
    <div id="bread">
    <a href="/"><?php echo Yii::t('t', 'Home')?></a>
    >> 产品大全
<?php /*
$father = ProductCategory::model()->findByPk($model->parent_id); 
if($father) {
?>
    <a href="<?php echo Yii::app()->createUrl('productCategory/index', array('id'=>$model->parent_id));?>"><?php echo $father->name;?></a>
    >>
<?php } ?>
<?php echo $model->name;
*/ ?>
    </div>
    <div id="main-content">
    
    <?php
    foreach($categories as $category) {
    	$_categories = $sub_categories[$category->id];	
	?>
	<h3><a href="<?php echo Yii::app()->createUrl('productCategory/index', array('id'=>$category->id));?>">
		<?php echo $category->name;?></a></h3>
	<ol>
	
	<?php foreach($_categories as $category) {?>
	<li>
		<a href="<?php echo Yii::app()->createUrl('productCategory/index', array('id'=>$category->id));?>">
			<?php echo $category->name;?>
		</a>
	</li>
	
	<?php } ?>
	
	</ol>
	
    <?php }?>
    </div>
    <div style="clear:both;"></div>
</div>

